export default function structure(param_l: string, char: '>' | '<' | '==' | '!=' | '>=' | '<=' | 'like' | 'like_ic' | 'in' | 'notin', ...params: any[]) {
	const param_r = params[0];
	const condition = {};
	condition[param_l] = {};
	let operation_name = '';
	let include = '';
	switch (char) {
		case '>':
			operation_name = '$gt';
			break;
		case '<':
			operation_name = '$lt';
			break;
		case '==':
			condition[param_l] = param_r;
			break;
		case '!=':
			operation_name = '$ne';
			break;
		case '>=':
			operation_name = '$gte';
			break;
		case '<=':
			operation_name = '$lte';
			break;
		case 'like':
			condition[param_l] = { $regex: '.*' + param_r + '.*' };
			break;
		case 'like_ic':
			condition[param_l] = { $regex: '.*' + param_r + '.*', $options: 'i' };
			break;
		case 'in':
			include = '$in';
			break;
		case 'notin':
			include = '$nin';
			break;
	}
	if (operation_name) {
		condition[param_l] = {};
		condition[param_l][operation_name] = param_r;
	} else if (include) {
		condition[param_l] = {};
		condition[param_l][include] = params;
	}
	return condition;
}
